package com.molichuxing.services.infrastructure.service;

import com.molichuxing.framework.dto.Paged;
import com.molichuxing.framework.result.ResponseResult;
import com.molichuxing.framework.service.RootService;
import com.molichuxing.services.infrastructure.dto.request.create.IovCreateAccountDto;
import com.molichuxing.services.infrastructure.dto.request.create.IovCreateGroupDto;
import com.molichuxing.services.infrastructure.dto.request.modify.IovModifyAccountDto;
import com.molichuxing.services.infrastructure.dto.request.modify.IovModifyGroupDto;
import com.molichuxing.services.infrastructure.dto.response.IovAccountDto;
import com.molichuxing.services.infrastructure.dto.response.IovGroupBindResourceDto;
import com.molichuxing.services.infrastructure.dto.response.IovGroupDto;
import com.molichuxing.services.infrastructure.dto.response.IovResourceDto;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author liuruifeng
 * 车联网权限服务
 * 2019-10-12
 */
public interface IovPermissionService extends RootService {


    /**
     * 车辆网创建用户接口
     *
     * @param account
     * @return
     */
    ResponseResult<Boolean> createAccount(IovCreateAccountDto account) throws Exception;

    /**
     * 车辆网编辑用户接口
     *
     * @param account
     * @return
     */
    ResponseResult<Boolean> modifyAccount(IovModifyAccountDto account) throws Exception;

    /**
     * 车辆网修改密码接口
     *
     * @param account
     * @return
     */
    ResponseResult<Boolean> modifyPassword(String account, String password) throws Exception;

    /**
     * 获取用户角色信息
     *
     * @param account
     * @return
     */
    ResponseResult<List<IovGroupDto>> getAccountGroupByAccount(String account) throws Exception;

    /**
     * 分页查询车联角色
     *
     * @return
     */
    ResponseResult<Paged<IovGroupDto>> getGroupListByPage(Map<String, Object> paramMap, int pageNum, int pageSize) throws Exception;

    /**
     * 查询车联网角色数量
     *
     * @return
     */
    ResponseResult<Integer> getGroupCount() throws Exception;

    /**
     * 获取角色绑定的权限列表
     *
     * @return
     */
    ResponseResult<IovGroupBindResourceDto> getGroupPermission(int groupId) throws Exception;

    /**
     * 添加角色
     *
     * @return
     */
    ResponseResult<Boolean> createGroup(IovCreateGroupDto dto) throws Exception;

    /**
     * 修改角色
     *
     * @return
     */
    ResponseResult<Boolean> modifyGroup(IovModifyGroupDto dto) throws Exception;

    /**
     * 添加权限
     * @param roleId 角色id
     * @param permissionIds 权限id集合
     * @return
     * @throws Exception
     */
    ResponseResult<Boolean> setPermission(int roleId, List<Integer> permissionIds) throws Exception;

    /**
     * 获取角色
     *
     * @return
     */
    ResponseResult<List<IovGroupDto>> getGroupList() throws Exception;

    /**
     * 根据邮箱集合，获取用户列表
     * @param accountList 邮箱集合
     */
    List<IovAccountDto> getAccountList(List<String> accountList) throws Exception;
}
